package com.hyt.it.ogt.kq.service.gov.feign.ks;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hyt.common.apiInfor.ApiResponse;
import com.hyt.it.ogt.kq.service.gov.feign.ks.model.KwExamCandidateVO;
import com.hyt.it.ogt.kq.service.gov.feign.ks.model.KwExamCollectConfigVO;
import com.hyt.it.ogt.kq.service.gov.feign.ks.model.KwExamVO;
import com.hyt.loginfo.config.OAuth2FeignRequestConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Set;

/**
 * 考试客户端熔断器
 *
 * @author chengxh
 * @since 2021-11-23
 */
@FeignClient(name = "it-ogt-kz", contextId = "ksFallbackFactory", fallbackFactory = KsFallbackFactoryClientHystrix.class, configuration = OAuth2FeignRequestConfig.class)
public interface KsFallbackFactoryClient {

    /**
     * 查询考试采集项配置
     * 状态码：20000：成功 41310901：失败
     *
     * @param examId
     * @return
     */
    @GetMapping("/api/gov/getExamCollectConfig/{examId}")
    ApiResponse<KwExamCollectConfigVO> getExamCollectConfig(@PathVariable String examId);

    /**
     * 查询考试学生的信息
     * 状态码：20000：成功 41311001：失败
     *
     * @param examId
     * @param current
     * @param size
     * @return
     */
    @GetMapping("/api/gov/pageCandidateInfo")
    ApiResponse<Page<KwExamCandidateVO>> pageCandidateInfo(@RequestParam String examId, @RequestParam int current, @RequestParam int size);

    /**
     * 查询当前考试列表
     *
     * @return
     */
    @GetMapping("/api/gov/listCurrentExam")
    ApiResponse<List<KwExamVO>> listCurrentExam(@RequestParam String officeId,
                                                @RequestParam String deptId);

    /**
     * 查询当前部门权限下的考试列表
     *
     * @return
     */
    @GetMapping("/api/gov/listDeptIdsExam")
    ApiResponse<List<KwExamVO>> listDeptIdsExam(@RequestParam String officeId,
                                                @RequestParam Set<String> deptIds);

    /**
     * 查询当前考试
     *
     * @param officeId
     * @param deptId
     * @param examId
     * @return
     */
    @GetMapping("/api/gov/exam")
    ApiResponse<KwExamVO> exam(
            @RequestParam String officeId,
            @RequestParam String deptId,
            @RequestParam String examId
    );

}
